home *** CD-ROM | disk | FTP | other *** search
/ ETO Development Tools 1 / ETO Development Tools 1.iso / Essentials / C++ AppleLink Messages / CPlus.Dev$ 2⁄9⁄90 / 0050-Thanks for a Quick A-Feb90 < prev    next >
Encoding:
Text File  |  1990-02-09  |  1.2 KB  |  35 lines  |  [TEXT/GEOL]

  1. Item forwarded  by  BLANTON      to AXELROD1
  2.  
  3. Item    3541734                         7-Feb-90        12:08PST
  4.  
  5. From:   WBJ                             Judd, William B
  6.  
  7. To:     CPLUS.APPLE$                    C++ Interest List--Apple Employees
  8.         CPLUS.DEV$                      C++ Interest List--Developers
  9.  
  10. Sub:    Thanks for a Quick Answer!
  11.  
  12. Thanks to John Dance for a quick answer to a perplexing problem!
  13.  
  14. John writes:
  15.  
  16. >Bill:
  17. >What you have run into is the difference in I/O models for Unix-like systems
  18. >and MPW.  MPW uses "the current selection" as input into tools.  When there is
  19. >no current selection, and you press enter, then the entire line is input into
  20. >the tool.  So rather than reading just your typed value, cin was reading:
  21. >Input distance in miles: <your value>.
  22. >This caused some error conditions in cin that the program isn't checking for.
  23. >The fix is very simple.  When you are doing input prompting in MPW, put out a
  24. >newline so that your input is always on a line by itself.  In your program,
  25. >just change the input prompt line to:
  26. >        cout << "Input distance in miles:\n";
  27. >Then everything will work as expected.
  28. >
  29. >John Dance
  30.  
  31. Thanks to everyone who read & thought about my question.
  32.  
  33. Bill Judd
  34.  
  35.